package org.github.manx98.jlibhac.tools.ncm;

import org.github.manx98.jlibhac.fs.IStorage;

import java.io.IOException;

/**
 * @author Manx98
 * @version 1.0
 * @since 2022/10/6 18:48
 */
public class CnmtFragmentSetInfo {
    public byte[] NcaIdOld;
    public byte[] NcaIdNew;
    public long SizeOld;
    public long SizeNew;
    public short FragmentCount ;
    public ContentType Type ;
    public UpdateType DeltaType;
    public int FragmentSetInfoField30 ;


    public CnmtFragmentSetInfo(IStorage reader) throws IOException {
        NcaIdOld = reader.readBytes(0x10);
        NcaIdNew = reader.readBytes(0x10);

        SizeOld = reader.readUint32().longValue();
        SizeOld |= reader.readUint16().longValue() << 32;
        SizeNew |= reader.readUint16().longValue() << 32;
        SizeNew = reader.readUint32().longValue();

        FragmentCount = reader.readShort();
        Type = ContentType.valueOf(reader.readByte());
        DeltaType = UpdateType.valueOf(reader.readByte());
        FragmentSetInfoField30 = reader.readInt();
    }
}
